using UnityEngine;
using System.Collections;

public class EventOnClicPortrait : MonoBehaviour {

	GUIButton button;
	public int characterIndex; 
	void Start ()
	{
		button = gameObject.GetComponent<GUIButton>();
		button.OnClickCallback += OnClick;
	}
	
	void OnClick(Vector3 pos){

        Character c = Player.instance.GetSelectedCharacter();
        if (c != null)
        {
            if (c.m_CharacterIndex == characterIndex)
            {
                CameraOmniVision.GetInstance().TranslateToPosition(c.transform.position);
                return;
            }
        }
        Player.instance.SelectCharacter(characterIndex);
	}
}
